package com.imooc.controller;

import com.google.gson.Gson;
import com.imooc.api.intercept.JWTCurrentUserInterceptor;
import com.imooc.base.BaseInfoProperties;
import com.imooc.pojo.Admin;
import com.imooc.pojo.Users;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/a/a")
@Slf4j
public class AuthController extends BaseInfoProperties {



    @RequestMapping("/in")
    public void startent(HttpServletRequest request) throws Exception {
    String userJson = request.getHeader(APP_USER_JSON);
        Users jwtUser = new Gson().fromJson(userJson,Users.class);
        log.info(jwtUser.toString());
        Users currentUser = JWTCurrentUserInterceptor.currentUser.get();
        //Admin adminUser=JWTCurrentUserInterceptor.adminUser.get();
        log.info("JWTCurrentUserInterceptor:"+ currentUser.toString());
        //log.info("JWTCurrentUserInterceptor:"+ adminUser.toString());
        System.out.println("-----测试打印---->");
    }
}
